App.CheckBoxGrid=function(g){
	var search = function(){
		var searchName = Ext.getDom('searchName').value;	
		store.load({params:{start:0,limit:1,key:searchName}});//加载数据
	}
	var sm = new Ext.grid.CheckboxSelectionModel({handleMouseDown: Ext.emptyFn,singleSelect : true});
    var cm = new Ext.grid.ColumnModel([
		sm,{
			header:'编号',
			dataIndex:'id',
			width:40
		},{
			header: "角色名称",
			dataIndex: 'name'
        },{
			header:'名称',
			dataIndex:'memo',
			width:120	
			
		}
    ]);
    cm.defaultSortable = true;
    var SaleArea = Ext.data.Record.create([
           {name: 'id', type: 'int'},
           {name: 'name', type: 'string'},
		   {name: 'memo'}
      ]);
	var store = new Ext.data.JsonStore({
		url:'../'+WebServiceUrl,
		baseParams:{trancode:'1020'},
		totalProperty:'totalProperty',
		root:'root',
		fields:SaleArea,
		pruneModifiedRecords:true
	});
	var grid = new Ext.grid.GridPanel({
    	id : 'BaseGrid',
        store: store,
        cm: cm,
        resizeable:true,
        height:230,
        width:500,
        frame:true,
		sm:sm,
		loadMask: {msg:'正在加载数据，请稍候。。。'},
		stripeRows:true,
		tbar : ['角色名称：', {
				xtype : 'trigger',
				id : 'searchName',
				width : 200,
				triggerClass : 'x-form-search-trigger',
				onTriggerClick : search
		}],
	    bbar: new Ext.PagingToolbar({
	        pageSize: 2,
	        store: store,
	        displayInfo: true,
	        displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
	        emptyMsg: "没有记录"
	    })
    });
    store.load({params:{start:0,limit:2}});
    var win = new Ext.Window({
    	id:'SelGrid',
		title : '角色选择',
		width : 500,
		height : 300,
		closable : false,
		collapsible : false,
		modal : true,
		defaults : {
			border : false
		},
		buttonAlign : 'right',
		items :grid,
		buttons :[{
			text:'确定',
			handler : function(){
				var _record = grid.getSelectionModel().getSelected();
				if (!_record) {
					Ext.MessageBox.alert('警告', '请选择一条信息!');
				} else {
					var BaseGrid = g;
					var BaseStore = BaseGrid.getStore();
					BaseGrid.stopEditing();
					BaseStore.insert(0,_record);
					BaseGrid.startEditing(0, 2);
					BaseStore.getAt(0).dirty=true;			
					win.close();
				}
			}
		},{
			text:'关闭',
			handler : function(){
				Ext.getCmp('SelGrid').close();
			}
		}]
    })    
    win.show();
}